import { useLocation, useSearchParams } from "react-router-dom"


export default function User() {
    const [searchParams,setSearchParams]=useSearchParams()
    const location=useLocation()
    console.log('--->',location.state,location.search)
  return (
    <div>
      <h1>User Page</h1>
      <p>username:{searchParams.get('username')}</p>
      <p>age:{searchParams.get('age')}</p>
      <button onClick={()=>setSearchParams({username:Math.random().toString(),age:'20'})}>Change</button>
    </div>
  )
}
